﻿/// <reference name="MicrosoftAjax.js"/>
/// <reference name="Dimok.Web.UI.JS.JQuery.VSDoc.js" assembly="Dimok.Web.UI" />
/// <reference name="Dimok.Web.UI.JS.MSAjaxExtentions.js" assembly="Dimok.Web.UI" />
/// <reference path="../../JS/UI/Dimok.PageEvents.js" />
Type.registerNamespace("motobankcorp");
motobankcorp.Payments = function(element) {
motobankcorp.Payments.initializeBase(this, [element]);
}
motobankcorp.Payments.prototype = {
  _wireEvents: function() {
    Dimok.FindPageEvents().add_loanSelected(Function.createDelegate(this, function(sender, eventArgs) {
      eventArgs.get_detailRGEs().push(this.get_RGE());
    }));
    Dimok.FindPageEvents().add_loanDeselected(Function.createDelegate(this, function(sender,eventArgs) {
      eventArgs.get_detailRGEs().push(this.get_RGE());
    }));
    Dimok.FindPageEvents().add_loanInserted(Function.createDelegate(this, function(sender, eventArgs) {
      return alert("LoanInserted Event is not implemented in Payments.");
      if (eventArgs.constructor == Dimok.Event.Loan && eventArgs.get_batchItemsCount() > 0) return;
      this._refreshSelected();
    }));
    Dimok.FindPageEvents().add_loanDeleted(Function.createDelegate(this, function() {
      return alert("LoanDeleted Event is not implemented in Payments.");
      this._refreshSelected();
    }));
    this.get_RGE().add_rowSelected(Function.createDelegate(this, function(sender, eventArgs) {
      Dimok.FindPageEvents().raise_paymentSelected(eventArgs);
    }));
    this.get_RGE().add_rowDeselected(Function.createDelegate(this, function(sender, eventArgs) {
      Dimok.FindPageEvents().raise_paymentDeselected(eventArgs);
    }));


  },
  initialize: function() {
    motobankcorp.Payments.callBaseMethod(this, 'initialize');
    this._wireEvents();
  },
  dispose: function() {
    motobankcorp.Payments.callBaseMethod(this, 'dispose');
  }
}
motobankcorp.Payments.registerClass('motobankcorp.Payments', Dimok.Table);
